package test;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class IntermediaryInvocation implements InvocationHandler {

    private Object target;

    public void setTarget(Object target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        before();
        Object feedback=method.invoke(target,args);
        after();

        return "查看："+feedback;
    }
    public void before(){
        System.out.println("前期准备");
        System.out.println("记录");
    }

    public void after(){
        System.out.println("后期跟踪");
        System.out.println("日志。");
    }
}
